package com.ddwl.data.controller;

import com.ddwl.common.annotation.Auth;
import com.ddwl.common.constant.BaseEnum;
import com.ddwl.common.controller.BaseController;
import com.ddwl.data.service.QRCodeParamsService;
import com.ddwl.schema.vo.base.RestVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author hemiaojun
 * @Date 2021/6/9 13:49
 */
@Api(tags = "二维码参数")
@RestController
@RequestMapping("/qrCodeParams")
public class QRCodeParamsController extends BaseController {


    @Resource
    private QRCodeParamsService qrCodeParamsService;


    @ApiOperation(value = "获取二维码参数")
    @GetMapping("/{id}")
    @Auth(required = false,product = {BaseEnum.ProductEnum.MALL, BaseEnum.ProductEnum.WBM, BaseEnum.ProductEnum.WBM_OFFICE, BaseEnum.ProductEnum.FENXIAO, BaseEnum.ProductEnum.BYTE_DANCE})
    public RestVo<String> get(@PathVariable("id") String id){
        return RestVo.ok(qrCodeParamsService.getQuery(id));
    }

    @ApiOperation(value = "保存二维码参数")
    @PostMapping()
    @Auth(required = false,product = {BaseEnum.ProductEnum.MALL, BaseEnum.ProductEnum.WBM, BaseEnum.ProductEnum.WBM_OFFICE, BaseEnum.ProductEnum.FENXIAO, BaseEnum.ProductEnum.BYTE_DANCE})
    public RestVo<String> save(@RequestParam String query){
        return RestVo.ok(qrCodeParamsService.save(query));
    }



}
